package com.zjd.service.impl;

import com.zjd.dao.CategoryDao;
import com.zjd.domain.Category;
import com.zjd.service.CategoryService;
import com.zjd.utils.MyBatisUtils;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class CategoryServiceImpl implements CategoryService {
    @Override
    public List<Category> selecAllCategorys() {
        SqlSession sqlSession = MyBatisUtils.getSqlSession();
        CategoryDao mapper = sqlSession.getMapper(CategoryDao.class);
        List<Category> categories = mapper.selecAllCategorys();
        return categories;
    }

    @Override
    public Category selectCategoryByRouteId(int cid) {
        SqlSession sqlSession = MyBatisUtils.getSqlSession();
        CategoryDao mapper = sqlSession.getMapper(CategoryDao.class);
        Category category = mapper.selectCategoryByRouteId(cid);
        return category;
    }
}
